package yagwl.client.view.fnd;

public class BrowserUtil {

  private static native void open(String url) /*-{
    $doc.location=url;
  }-*/;

  public static native String getPathName() /*-{
    return $wnd.location.pathname;
  }-*/;

  public static native String getSearchString() /*-{
    return $wnd.location.search;
  }-*/;

  public static String resolveHostedHref(String href) {
    String searchString = getSearchString();
    if (searchString.startsWith("?gwt.codesvr=")) {
      href = href + searchString;
    }
    return href;
  }

  public static void redirect(String href) {
    open(resolveHostedHref(href));
  }

}
